<html>
<head>
	<title>Projects</title>
    <link rel="stylesheet" href="<?php print WEB_PATH . LConfig::getStyle();  ?>" type="text/css" />
    <?php print LConfig::getSyntaxHighlighter(); ?>
    <?php if(!empty($data_id)){ print LConfig::getSyntaxBrush($data_id[0]['link_type']); } ?>
</head>
<body>
	<div class="main">
    	<div class="mheader">
        	<div class="logo_img"><a href="<?php print "?article" ?>"><img width="64px" src="<?php print WEB_PATH . LConfig::getLogo(); ?>" title="Source Viewer" /></a></div>
            <div class="logo_title"><?php print LConfig::getTitle(); ?></div><div class="clear_both"></div>
        </div>
        <?php
        //print_r($data);
            if(count($data) > 0){
                 foreach ($data as $art){
        ?>
        <div class="article">
        	<div class="article_icon"><a href="<?php print "?article&id=" . $art['id']; ?>"><img width="24px" src="<?php print WEB_PATH . LConfig::getArticleIcon(); ?>"/></a></div>
        	<div class="article_id"><a href="<?php print "?article&id=" . $art['id']; ?>"><?php print $art['id']; ?></a></div>
            <div class="article_name">
                <a href="<?php print "?article&id=" . $art['id']; ?>"><?php print $art['name']; ?></a>
                <div style="float: right; font-size: 11pt; margin-right: 20px; font-weight: 100;"><em>Posted:</em> <?php print $art['datum']; ?></div>
                <div style="float: right; font-size: 11pt; margin-right: 20px; font-weight: 100;"><em>Author:</em> <?php print $art['author']; ?></div>
                <div class="clear_both"></div>
            </div>
            <div class="clear_both"></div>
            <div class="article_body">
            	<div class="article_image"><img height="150px" src="
            	<?php 
            	    if(file_exists(WEB_PATH . IMAGE_PATH . $art['img'])){
                        print WEB_PATH . IMAGE_PATH . $art['img'];
                    }else{
                        print WEB_PATH . IMAGE_PATH . LConfig::getNoImg();
                    } 
                ?>" title=""/></div>
                <div class="article_description">
                	<div class="article_description_text"><?php print $art['description']; ?></div>
                    <div class="article_links">
                    	<?php 
                            if(!array_key_exists('source', $art)){ ?>
                        <a class="article_source" href="<?php print "?article&id=" . $art['id'] . "&src=all"; ?>">Source</a>
                        <?php } ?>
                        <a class="article_demo" href="<?php print $art['link']; ?>">Demo</a>
                    </div>
                </div>
                <div class="clear_both"></div>
            </div>
            <?php if(array_key_exists('source', $art)){  ?>
            
            <div class="clear_both"></div>
            
            <div class="source_header" style="height: 35px;">
               	  <ul>
                    	<a 
                    	    <?php if(!empty($data_id)){ if($data_id[0]['link_type'] == 'all'){ print 'class="active_link"'; }else{ print ""; } }?> 
                    	href="<?php print "?article&id=" . $data[0]['id'] . "&src=all"; ?>"><li>ALL</li></a>
                    	<a 
                    	    <?php if(!empty($data_id)){ if($data_id[0]['link_type'] == 'php'){ print 'class="active_link"'; }else{ print ""; } }?>
                    	href="<?php print "?article&id=" . $data[0]['id'] . "&src=php"; ?>"><li>PHP</li></a>
                    	<a 
                    	    <?php if(!empty($data_id)){ if($data_id[0]['link_type'] == 'css'){ print 'class="active_link"'; }else{ print ""; } }?>
                    	 href="<?php print "?article&id=" . $data[0]['id'] . "&src=css"; ?>"><li>CSS</li></a>
                    	<a 
                    	    <?php if(!empty($data_id)){ if($data_id[0]['link_type'] == 'sql'){ print 'class="active_link"'; }else{ print ""; } }?>
                    	href="<?php print "?article&id=" . $data[0]['id'] . "&src=sql"; ?>"><li>SQL</li></a>
                  </ul>
            </div>
                <div class="clear_both"></div>
            <?php if(!empty($data_id)){ foreach($data_id as $source){ ?>
            <div class="source_art">
                	<div class="source_title"><?php print $source['filename'] ?></div>
                	<pre class="brush: <?php print $source['type'];  ?>">
                    	<?php print $source['content'] ?>
                    </pre>
            </div>
            <?php } }else{ ?>
                <div class="source_art">
                    <div style="color:#F00F00;"> No Source File </div>
                </div>
            <?php } } ?>
            <div class="clear_both"></div>
        </div>
        <?php } } ?>
    </div>
</body>
</html>